<template>
	<view class="page">
		<cu-custom bgColor="bg-white" :isBack="true" >
			<block slot="content">二维码名片</block>
		</cu-custom>
		<view class="p-5">
			<view class="bg-gray p-4 rounded">
				<view class="flex align-center mb-4">
					<free-avater :src="detail.avatar || 'https://hys-online.oss-cn-guangzhou.aliyuncs.com/hyz/icon/images/demo/demo5.jpg'"></free-avater>
					<view class="pl-4 flex flex-column">
						<text class="font-md">{{detail.name}}</text>
						<text class="font-sm">{{detail.area}}</text>
					</view>
				</view>
				<view class="flex flex-column align-center justify-center">
					<image :src="src" 
					style="width: 550rpx;height: 550rpx;"
					class="bg-secondary mb-4"></image>
					<text class="font text-light-muted">扫一扫上边二维码图案</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import freeAvater from '@/components/free-ui/free-avater.vue';
	import { mapState } from 'vuex'
	import $C from '@/common/free-lib/qrcode.js';
	export default {
		components: {
			freeAvater,
		},
		data() {
			return {
				// userInfo: uni.getStorageSync('userinfo'),
				detail:{
					id:0,
					name:"",
					avatar:""
				},
				src:""
			}
		},
		onLoad(e) {
			if(e.params){
				this.detail = JSON.parse(decodeURIComponent(e.params))
				console.log('00000000000000000000000000..............',this.detail);
				this.src = `${$C.codeUrl}/${e.type}_qrcode/${this.detail.id}?token=${this.user.token}`
			}
		},
		computed: {
			...mapState({
				user:state=>state.user.user
			})
		},
		methods: {
			getQrCode(){
				this.$C.get(`/user_qrcode/${this.detail.id}?token=${this.user.token}`,{
				}).then(res=>{
					
				})
			}
		}
	}
</script>

<style>

</style>
